<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.thymeleaf.org"
      layout:decorator="layout/pc_master">
<div layout:fragment="content" class="section page-content">
    <link rel="stylesheet" href="/pc/css/center/setup/index.css">
    <!-- s: 导航 -->
    <div class="breadcrumb-wrap">
        <div class="layui-main clearfix">
            <div class="breadcrumb">
                <a href="/">首页</a> - <a href="/center">用户中心</a> - 设置
            </div>
        </div>
    </div>
    <!-- e: 导航 -->
    <div class="section page-content">
        <div class="layui-main clearfix">

         <div th:include="layout/center_left :: center_left" class="manage-aside"></div>

            <div class="manage-main">
                <ul class="layui-nav nav main-nav">
                    <li class="layui-nav-item layui-this">
                        <a href="/center/setup">
                            设置
                        </a>
                    </li>

                    <li class="layui-nav-item">
                        <a href="/center/setup/blacklist">
                            黑名单
                        </a>
                    </li>


                    <span class="layui-nav-bar" style="left: 20px; top: 57px; width: 0px; opacity: 0;"></span></ul>
                <div class="main-content">


                    <div class="lists">
                        <div class="item on">
                            <div class="item-icon"><div class="icon"><svg t="1609246292433" class="i" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" style="fill:#FFF"><path d="M780.995 419.328H376.919V269.64c0-49.577 60.319-104.745 134.661-104.745 74.368 0 134.759 55.168 134.759 104.745v44.928h0.527a52.296 52.296 0 0 0 51.773 44.897c26.445 0 48.22-19.507 51.866-44.897h0.594v-44.923c0-115.712-107.28-209.526-239.514-209.526-132.213 0-239.462 93.814-239.462 209.526v149.683h-29.957c-49.552 0-89.754 40.207-89.754 89.79v359.219c0 49.582 40.202 89.774 89.754 89.774h538.829c49.617 0 89.784-40.192 89.784-89.774v-359.22c0-49.582-40.167-89.789-89.784-89.789z m-224.477 331.52v40.94c0 25.712-20.121 46.545-44.938 46.545-24.755 0-44.907-20.833-44.907-46.545v-40.935c-35.364-16.573-59.889-52.173-59.889-93.43 0-57.118 46.96-103.434 104.796-103.434 57.897 0 104.796 46.316 104.796 103.434 0 41.252-24.463 76.857-59.858 93.43z"></path></svg></div></div>
                            <div class="item-title">登录密码</div>
                            <div class="item-info">
                                <a th:if="${userModel.password ne null and userModel.password ne ''}"
                                        class="status on" href="/center/setup/user_password"><font color="#2696da">修改</font></a>
                                <a th:if="${userModel.password eq null or userModel.password eq ''}"
                                   class="status on" href="/center/setup/user_password">未设置</a>
                            </div>
                        </div>
                        <div class="item on">
                            <div class="item-icon"><i class="auth-icon icon  mobile "></i></div>
                            <div class="item-title">绑定手机</div>
                            <div class="item-info">
                                <a th:if="${userModel.mobile ne null and userModel.mobile ne ''}"
                                   class="status on" href="/center/setup/user_mobile"><font color="#2696da">修改</font></a>
                                <a th:if="${userModel.mobile eq null or userModel.mobile eq ''}"
                                   class="status on" href="/center/setup/user_mobile">绑定</a>
                            </div>
                        </div>

                        <div class="item on">
                            <div class="item-icon"><i class="auth-icon icon  email "></i></div>
                            <div class="item-title">绑定邮箱</div>
                            <div class="item-info">
                                <a th:if="${userModel.email ne null and userModel.email ne ''}"
                                   class="status on" href="/center/setup/user_email"><font color="#2696da">修改</font></a>
                                <a th:if="${userModel.email eq null or userModel.email eq ''}"
                                        class="status on" href="/center/setup/user_email">绑定</a>
                            </div>
                        </div>
                        <div style="height: 50px;"></div>
                        <div class="item layui-form">
                            <div class="item-title">接收通知<font style="font-size: .6rem; color: #AAA;">（短信/微信）</font></div>
                            <div class="item-info">
                                <input type="checkbox" name="notice" lay-skin="switch" lay-filter="notice" th:value="${userModel.notice}" title=""
                                       th:checked="${userModel.notice eq 1 ?true:false}">
                                <div class="layui-unselect layui-form-switch layui-form-onswitch" lay-skin="_switch"><em></em><i></i></div>
                            </div>
                        </div>
                        <div class="item layui-form">
                            <div class="item-title">关闭资料<font style="font-size: .6rem; color: #AAA;">（关闭后无法交友）</font></div>
                            <div class="item-info">
                                <input type="checkbox" name="close" lay-skin="switch" lay-filter="close" title=""
                                       th:value="${bcSingles.isClose}"
                                       th:checked="${bcSingles.isClose eq 1 ?true:false}"
                                >
                                <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em></em><i></i></div>
                            </div>
                        </div>
                    </div>
                    <div style="height: 50px;"></div>
                </div>

            </div>

        </div>
    </div>

</div>
<div layout:fragment="contentFooter">
    <script type="text/javascript">
        //监听指定开关
        layui.form.on('switch(close)', function(data){
            var close = (this.checked ? 1 : 0)
            bottlecms.put("/m/ajax/center/single/modify", {close:close}, function(data) {
                if (data.success == true) {
                      bottlecms.toast(data.msg);
                } else {
                    bottlecms.toast(data.msg);
                }
            });

        });


        layui.form.on('switch(notice)', function(data){
            var notice = (this.checked ? 1 : 0)
            bottlecms.get("/m/ajax/center/setup/notice", { notice:notice}, function(data) {
                if (data.success == true) {
                    bottlecms.toast(data.msg);
                } else {
                    bottlecms.toast(data.msg);
                }
            });

        });




        var _page = $('.page');


        // 结束微信绑定
        $(_page).on('click', '[release-bind]', function() {
            var way = $(this).attr('release-bind');
            bottlecms.log(1111)
            bottlecms.confirm("确定要解除绑定吗？", function() {
                bottlecms.log(222)
                bottlecms.get(BOTTLECMS_HOME_PATH + "oauth/" + way + "/release", null, function(data) {
                    bottlecms.log(3333)
                    if (data.success == true) {
                        location.reload();
                        bottlecms.toast(data.msg);
                    } else {
                        bottlecms.toast(data.msg);
                    }
                })
            });

        });
    </script>
</div>
</html>